<template>
  <div class="airticle ">
      <!-- 三张图片结构 -->
      <div class="type-1" v-if="postlist_content.images.length>=3">
         <nuxt-link :to="`post/detail?id=${postlist_content.id}`">
          <div class="header">
              <h4>{{postlist_content.title}}</h4>         
          <div class="detail">
          <div class="airticle_detail">{{postlist_content.summary}}</div>
          </div>
      </div>
    <!--图片 -->
    <div class="imgs">
          <img :src="postlist_content.images[0]" alt class="showImgs" />
          <img :src="postlist_content.images[1]" alt class="showImgs" />
          <img :src="postlist_content.images[2]" alt class="showImgs" />
    </div>
     </nuxt-link>
    <!-- 底部 -->
    <div class="dec">
    <div class="left">
        <span>
            <i class="el-icon-location-outline"></i>
            {{postlist_content.cityName}}
        </span>
        <div class="author">
          by 
             <nuxt-link to="post/personal" class="personal">  
            <img :src="$axios.defaults.baseURL +postlist_content.account.defaultAvatar"/>            
              <span  class="nickname" >
                {{postlist_content.account.nickname}}
             </span>    
             </nuxt-link>         
       </div>
       <span>
            <i  class="el-icon-view"></i>
             {{postlist_content.watch}}
       </span>
       </div>
          <span class="right" v-if="postlist_content.like"> {{postlist_content.like}}赞</span>
          <span class="right" v-else>0赞</span>
       </div>
       </div> 
       <!-- jieshu1 -->
  <!-- 两张图结构-->
   <div class="type-2"  v-else-if="postlist_content.images.length<3&&postlist_content.images.length>=1">
    <div class="content">
      <nuxt-link :to="`post/detail?id=${postlist_content.id}`">
      <!-- 图片 -->
      <div class="left-imgs">
       <a href class="showImgs">
         <img :src="postlist_content.images[0]" alt />
           </a>
        </div> 
        </nuxt-link>    
        <!-- 标题加内容 -->
       <div class="right_header">
          <nuxt-link :to="`post/detail?id=${postlist_content.id}`">
            <div class="up-detail">
            <h4> {{postlist_content.title}}</h4>
            <div class="detail_content">
             <div href class="detail">{{postlist_content.summary}} </div>
            </div>
           </div>
          </nuxt-link>
          <!-- 底部 -->
            <div class="dec">
        <div class="left">
        <span>
            <i  class="el-icon-location-outline"></i>
            {{postlist_content.cityName}}
        </span>
        <div class="author">
           by 
             <nuxt-link to="post/personal" class="personal">  
            <img :src="$axios.defaults.baseURL +postlist_content.account.defaultAvatar"/>
             <span  class="nickname">
               {{postlist_content.account.nickname}}
             </span>
             </nuxt-link>
      </div>
     <span>
      <i class="el-icon-view"></i>
      <span v-if="postlist_content.watch">{{postlist_content.watch}}</span>
      <span v-else>0</span>
      </span>
      </div>
    <span class="right" v-if="postlist_content.like"> {{postlist_content.like}}赞</span>
    <span class="right" v-else> 0赞</span>
     </div>
    </div> 
   </div> 
       
     </div> 
    <!--一张图 -->
 <div class="type-2" v-else>
    <div class="content">       
        <!-- 标题加内容 -->
       <div class="right_header">
          <nuxt-link :to="`post/detail?id=${postlist_content.id}`">
            <div class="up-detail">
            <h4> {{postlist_content.title}}</h4>
            <div class="detail_content">
             <div href class="detail">{{postlist_content.summary}} </div>
            </div>
           </div>
          </nuxt-link>
          <!-- 底部 -->
            <div class="dec">
        <div class="left">
        <span>
            <i data-v-2372b9a8 class="el-icon-location-outline"></i>
            {{postlist_content.cityName}}
        </span>
        <div class="author">
           by
              <nuxt-link to="post/personal" class="personal">  
             <img :src="$axios.defaults.baseURL +postlist_content.account.defaultAvatar"/>
             <span  class="nickname">
               {{postlist_content.account.nickname}}
             </span>
              </nuxt-link>
      </div>
     <span>
      <i class="el-icon-view"></i>
      <span v-if="postlist_content.watch">{{postlist_content.watch}}</span>
      <span v-else>0</span>
      </span>
      </div>
    <span class="right" v-if="postlist_content.like"> {{postlist_content.like}}赞</span>
    <span class="right" v-else> 0赞</span>
     </div>
    </div> 
   </div> 
 </div>
     </div>
</template>

<script>
export default {
props:["postlist_content"]
}
</script>

<style lang="less" scoped>
.airticle {
    width:700px;
    margin:0 auto;
    h4{
    overflow: hidden;
    height: 24px;
    font-size: 18px;
    font-weight: normal;
    margin-bottom: 16px;
      &:hover{
          color:orange;
        }  
}
.detail {
    font-size: 14px;
    overflow: hidden;
    height: 63px;
    line-height: 1.5;
    .airticle_detail{
      color: #666;
    }
}
.imgs{
    display: flex;
    margin:16px 0;
   img{
     flex: 1;
      display: block;
      width: 220px;
      height: 150px;
      object-fit: cover;
     padding-right: 10px;
   } 
}
}

.type-2{
    padding-bottom: 16px;
    box-sizing: border-box;
     .content {
      display: flex;
      justify-content: space-between;
      .left-imgs {
        width: 220px;
        height: 150px;
        flex-shrink: 0;
        margin-right: 16px;
        img {
          display: block;
          width: 100%;
          height: 100%;
          object-fit: cover;
        }
        .detail {
    font-size: 14px;
    overflow: hidden;
    height: 63px;
    line-height: 1.5;
    .airticle_detail{
      color: #666;
    }
}
}
  .right_header{
        flex: 1;
       .up-detail {
          margin-bottom: 16px;    
          width: 460px;
      .detail_content {
       margin-bottom: 15px;
       line-height: 1.5;
       font-size: 14px;
       height: 63px;
       overflow: hidden;
       text-overflow: ellipsis;
       display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      }
       .airticle_detail{
           color: #666;
    }
}          
}
}
}

 .dec {
    display: flex;
    font-size: 12px;
    color: #999;
    justify-content: space-between;
    align-items: center;
    .left {
      display: flex;
      align-items: center;
      span {
        margin-right: 10px;
        line-height: 26px;
      }
      .author {
        display: flex;
        margin-right: 10px;
        align-items: center;
       .personal{
         display: flex;
       }
        img {
          display: block;
          margin: 5px;
          width: 16px;
          height: 16px;
          border-radius: 50%;
        }
      }
    }
    .right {
      text-align: right;
      font-size: 16px;
      color: orange;
    }
  }
.type-1,.type-2{
    padding:16px 0;
    border-bottom:1px solid #dddddd;
}

</style>